import unittest

class MarkupTestCase(unittest.TestCase):
    def testMarkup(self):
        from pennypress.apps.news.markup import *
        from pennypress.apps.news.models import RecurringInline

        fixture = """<p>Paragraph 1</p>
        <div class="inline inline-left">Text Inline</div>
        <p>Paragraph 2</p>
        <div class="inline inline-right">This is a recurring inline</div>
        <p>Paragraph 3</p>"""

        story_xml = """
<story>
  <p>Paragraph 1</p>
  <object src="textinline" xml:base="news.default">
    <param name="align" value="left" />
    <p>Text Inline</p>
  </object>
  <p>Paragraph 2</p>
  <object src="recurringinline" xml:base="news:default" id="1">
    <param name="align" value="right" />
  </object>
  <p>Paragraph 3</p>
</story>"""
        # Create a recurring inline for the markup
        ri = RecurringInline(text="This is a recurring inline")        
        ri.save()

        # Render the markup
        result = markup_story(story_xml)
        
        # Assert that the fixture and the result are equal
        self.assertEquals(result, fixture)
